package libdb;

import java.sql.DriverManager;
import java.sql.SQLException;




public class DBConnect {
private String driver = "";
private String url = "";
private String user = "";
private String password = "";
private String tipoDB = "";
java.sql.Connection dbConnection;

public DBConnect (char p_tipo){
	switch (p_tipo)
	{
	//Mysql
	case 'M':  
		this.driver = "com.mysql.jdbc.Driver";
		this.url = "jdbc:mysql://127.0.0.1:3306/grafici";
		this.user = "root";
		this.password = "";
		this.tipoDB = "Mysql";
	break;
	//Postgress
	case 'P':
		this.driver = "org.postgresql.Driver";
		this.url = "jdbc:postgresql://127.0.0.1:5432/OpenStat";
		this.user = "postgres";
		this.password = "hardware";
		this.tipoDB = "Postgres";
	break;
	//AS400
	case '4':
		this.driver = "com.ibm.as400.access.AS400JDBCDriver";
		this.url = "jdbc:as400://mySystem;naming=sql;errors=full";
		this.user = "ca400";
		this.password  = "ca400";
		this.tipoDB = "DB2";
		break;
	//Access
	case 'A':
		this.driver = "sun.jdbc.odbc.JdbcOdbcDriver";
		this.url = "jdbc:odbc:Driver={Microsoft Access Driver " +
            "(*.mdb, *.accdb)};DBQ=C:\\Database\\Northwind 2007.accdb";
		this.user = "";
		this.password  = "";
		this.tipoDB = "MSAccess";
		break;
		//Access
	case 'S':
		this.driver = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
		this.url = "jdbc:microsoft:sqlserver://localhost:1433";
		this.user = "SA";
		this.password  = "SA";
		this.tipoDB = "MSSQL";
		break;
	
	}
	return;
	
}//Fine 
















// Getter
public String getUrl() {
	return url;
}
public String getDriver() {
	return driver;
}

public String getUser() {
	return user;
}
public String getPassword() {
	return password;
}

public String getTipoDB() {
	return tipoDB;
}

}//Fine Classe
